<?php
namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request; //命名空间的三元素：常量，方法和类
use DB;
use Session;
use App\Http\Model\User;

class VipController extends Controller{
    // 显示会员信息
    public function LookUser(){
        $result = User::paginate(6);
        return view('admin/user/user',compact('result'));
    }

    // 删除会员信息
    public function Deluser($id){
        User::where('userid',$id)->delete();
        return ['status'=>0,'msg'=>'删除成功'];
        // $result =  User::where('userid',$id)->delete();
        // if($result > 0){
        //     return back();
        // }
    }

     // 复选框删除
     public function Delalluser(){
        foreach ($_POST['checked'] as $key => $id) {
          $result =  User::where('userid',$id)->delete();
        }
        if($result>0){
            return redirect('admin/user');
        }
        else
        {
            return back();
        }
       
    }
}